<?php

namespace common\models\c2\entity;

use Yii;

/**
 * This is the model class for table "{{%audit}}".
 *
 * @property integer $id
 * @property integer $type
 * @property resource $reason
 * @property integer $audit_rule_id
 * @property integer $created_by
 * @property integer $update_by
 * @property integer $is_closed
 * @property string $closed_at
 * @property integer $status
 * @property string $created_at
 * @property string $updated_at
 */
class Audit extends \cza\base\models\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%audit}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['audit_rule_id', 'created_by', 'update_by'], 'integer'],
            [['closed_at', 'created_at', 'updated_at'], 'safe'],
            [['type', 'is_closed', 'status'], 'string', 'max' => 4],
            [['reason'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app.c2', 'ID'),
            'type' => Yii::t('app.c2', 'Type'),
            'reason' => Yii::t('app.c2', 'Reason'),
            'audit_rule_id' => Yii::t('app.c2', 'Audit Rule ID'),
            'created_by' => Yii::t('app.c2', 'Created By'),
            'update_by' => Yii::t('app.c2', 'Update By'),
            'is_closed' => Yii::t('app.c2', 'Is Closed'),
            'closed_at' => Yii::t('app.c2', 'Closed At'),
            'status' => Yii::t('app.c2', 'Status'),
            'created_at' => Yii::t('app.c2', 'Created At'),
            'updated_at' => Yii::t('app.c2', 'Updated At'),
        ];
    }

    /**
     * @inheritdoc
     * @return \common\models\c2\query\AuditQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new \common\models\c2\query\AuditQuery(get_called_class());
    }
    
    /**
    * setup default values
    **/
    public function loadDefaultValues($skipIfSet = true) {
        parent::loadDefaultValues($skipIfSet);
    }

}
